package ai.assist.admin.dto;

import ai.assist.common.utils.DateUtilsEx;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author hui
 * @Date 2023/3/20 20:32
 **/
@Data
@ApiModel
public class WarningWorkformQueryDTO implements Serializable {

    @ApiModelProperty("分类编码")
    private Long category;

    @ApiModelProperty("投诉对象")
    private String complaintObject;

    @ApiModelProperty("投诉事件")
    private String complaintIncident;

    @ApiModelProperty("同道路多次投诉道路名称")
    private String wfRoadName;

    @ApiModelProperty("次数")
    private Integer times = 0;

    @ApiModelProperty("开始时间")
    private List<String> dateRange;

    @ApiModelProperty(hidden = true)
    private Date startTime;

    @ApiModelProperty(hidden = true)
    private Date endTime;

    public Date getStartTime() {
        if (dateRange != null && !dateRange.isEmpty()) {
            return DateUtilsEx.getDayStart(DateUtilsEx.parseDayByDay(dateRange.get(0)));
        }
        return startTime;
    }

    public Date getEndTime() {
        if (dateRange != null && !dateRange.isEmpty() && dateRange.size() == 2) {
            return DateUtilsEx.getDayEnd(DateUtilsEx.parseDayByDay(dateRange.get(1)));
        }
        return endTime;
    }

}
